import PromotionHome from "./promotionHome";
import AddPromotion from "./addPromotion";
import CommodityHome from "./commodityHome";
import AddCommodity from "./addCommodity"
import EditPromotion from './editPromotion'
import React, { useRef, useState } from 'react'


const PromotionManagement = () => {
    const [isShow, setShow] = useState(0)

    const ShowNode = () => {
        const getChildCount = (val) => {
            setShow(val)
        };

        switch (isShow) {
            case 0:
                return <PromotionHome getCount={getChildCount} ></PromotionHome>
            case 1:
                return <AddPromotion getCount={getChildCount}></AddPromotion>
            case 2:
                return <CommodityHome getCount={getChildCount}></CommodityHome>
            case 3:
                return <AddCommodity getCount={getChildCount}></AddCommodity>
            case 4:
                return <EditPromotion getCount={getChildCount}></EditPromotion>
            default:
                break;
        }
    }

    return (
        <div>
            <div>
                {<ShowNode />}
            </div>
        </div>
    );
}

export default PromotionManagement;